module.exports = function(window, document) {
	var apivm = require('../../common/avm.min')(window, document);
	var avm = apivm;
	var api = apivm.api;
	var Component = apivm.Component;
	var $ = apivm.$;
	(function() {
	var Tabbar = /*@__PURE__*/ (function(Component) {
		function Tabbar(props) {
			Component.call(this, props);
			this.data = {};
		}

		if (Component) Tabbar.__proto__ = Component;
		Tabbar.prototype = Object.create(Component && Component.prototype);
		Tabbar.prototype.constructor = Tabbar;
		Tabbar.prototype.apiready = function() {};
		Tabbar.prototype.goPage = function(pagename) {
			var pagePath = {
				index: "../index/index",
				friend: "../friend/friend",
				message: "../message/message",
				me: "../me/me",
				addVideo: "../addVideo/addVideo"
			};

			wx.redirectTo({url: pagePath[pagename]});
		};
		Tabbar.prototype.render = function() {
			var this$1 = this;
			return apivm.h(
				"view",
				{class: "tabbar"},
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "index" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("index");
						}
					},
					"首页"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "friend" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("friend");
						}
					},
					"朋友"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						onClick: function() {
							return this$1.goPage("addVideo");
						}
					},
					apivm.h("image", {src: "../../image/add.png"})
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "message" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("message");
						}
					},
					"消息"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "me" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("me");
						}
					},
					"我"
				)
			);
		};

		return Tabbar;
	})(Component);
	apivm.define("tabbar", Tabbar);

	var Message = /*@__PURE__*/ (function(Component) {
		function Message(props) {
			Component.call(this, props);
			this.data = {
				messages: [
					{
						id: "000",
						nickname: "小庆幸",
						desc: "10分钟在线",
						headimg: "https://a415432669.github.io/shortvideo/000.jpg",
						list: [
							{
								from: {
									nickname: "小庆幸",
									heading: "https://a415432669.github.io/shortvideo/000.jpg"
								},

								to: {
									nickname: "老陈",
									heading: "https://a415432669.github.io/shortvideo/001.jpg"
								},

								content: "你吃了吗？",
								sendTime: "2022-01-10 20:20:22"
							}
						]
					},

					{
						id: "000",
						nickname: "小庆幸",
						desc: "10分钟在线",
						headimg: "https://a415432669.github.io/shortvideo/000.jpg",
						list: [
							{
								from: {
									nickname: "小庆幸",
									heading: "https://a415432669.github.io/shortvideo/000.jpg"
								},

								to: {
									nickname: "老陈",
									heading: "https://a415432669.github.io/shortvideo/001.jpg"
								},

								content: "你吃了吗？",
								sendTime: "2022-01-10 20:20:22"
							}
						]
					},

					{
						id: "000",
						nickname: "小庆幸",
						desc: "10分钟在线",
						headimg: "https://a415432669.github.io/shortvideo/000.jpg",
						list: [
							{
								from: {
									nickname: "小庆幸",
									heading: "https://a415432669.github.io/shortvideo/000.jpg"
								},

								to: {
									nickname: "老陈",
									heading: "https://a415432669.github.io/shortvideo/001.jpg"
								},

								content: "你吃了吗？",
								sendTime: "2022-01-10 20:20:22"
							}
						]
					},

					{
						id: "000",
						nickname: "小庆幸",
						desc: "10分钟在线",
						headimg: "https://a415432669.github.io/shortvideo/000.jpg",
						list: [
							{
								from: {
									nickname: "小庆幸",
									heading: "https://a415432669.github.io/shortvideo/000.jpg"
								},

								to: {
									nickname: "老陈",
									heading: "https://a415432669.github.io/shortvideo/001.jpg"
								},

								content: "你吃了吗？",
								sendTime: "2022-01-10 20:20:22"
							}
						]
					}
				]
			};
		}

		if (Component) Message.__proto__ = Component;
		Message.prototype = Object.create(Component && Component.prototype);
		Message.prototype.constructor = Message;
		Message.prototype.apiready = function() {
			var this$1 = this;
			//like created
			api.ajax(
				{
					url:
						"https://a6197037785854-dev.apicloud-saas.com/api/messages/getMessages"
				},
				function(ret, err) {
					// console.log(ret)
					ret.data.forEach(function(item) {
						return this$1.data.messages.push(item);
					});
				}
			);
		};
		Message.prototype.render = function() {
			return apivm.h(
				"view",
				{class: "page"},
				apivm.h(
					"view",
					{class: "messages"},
					Object.entries(this.data.messages).map(function(ref) {
						var index$1 = ref[0];
						var item$1 = ref[1];
						return apivm.h(
							"view",
							{class: "msg-item"},
							apivm.h("image", {src: item$1.headimg}),
							apivm.h(
								"view",
								{class: "info"},
								apivm.h("view", {class: "username"}, item$1.nickname),
								apivm.h("view", {class: "desc"}, item$1.desc)
							)
						);
					})
				),
				apivm.h("tabbar", {active: "message"})
			);
		};

		return Message;
	})(Component);
	apivm.define("message", Message);
	apivm.render(apivm.h("message", null), "body");
})();

	window['createApp'] = function() {
		apivm.$_start();
	}
	return avm;
}